const myRequest = (method,url,data) => {
	//如果全网址,就不加
	const baseURL =
				/^https:\/\/|http:\/\//.test(url)?
				'':'http://localhost:8800/StarRiverCup/'
	return new Promise((resolve,reject)=>{
		uni.request({
			url:baseURL + url,
			method:method.toUpperCase(),
			data,//{...} || undefined
			success: result=>{
				// console.log(result)
				if(result.statusCode==200)
					{
						const ok = result.data.isOk
						if(ok === true || ok === undefined)
							resolve(result.data)
						reject(result.data)
					}
				else
					reject(result.toString())
			},
			fail:err=>{
				// console.log(err)
				reject('接口调用失败')
			}
		})
	})
}
export default myRequest
// this.myRequest('get',url)
// this.myRequest("post",url,{})